// import {createMemoryHistory, createRouter, createWebHistory} from 'vue-router'
// import Login from "@/components/Login.vue";
// import Home from "@/components/Home.vue";
// import Manager from "@/components/Manager.vue";
// import Book from "@/components/Book.vue";
// import Info from "@/components/Info.vue";
//
//
// const routes = [
//     { path: '/', component: Login, name: 'Login' },
//     { path: '/home', component: Home ,name: 'Home' },
//     {
//         path: '/manager',component: Manager,name: 'Manager',children:[
//             {path: 'book',component: Book,name: 'book'},
//             {path: 'info',component: Info,name: 'info'},
//             // {path: }
//         ]
//     },
//
// ]
//
// export const router= createRouter({
//     history: createWebHistory(),
//     routes,
// })



import { createRouter, createWebHistory } from 'vue-router'
import Login from "@/components/Login.vue"
import Home from "@/components/Home.vue"
import Manager from "@/components/Manager.vue"
import Book from "@/components/Book.vue"
import Info from "@/components/Info.vue"
import SystemHome from "@/components/SystemHome.vue"

const routes = [
    {
        path: '/',
        redirect: '/login'  // 重定向到登录页
    },
    {
        path: '/login',
        component: Login,
        name: 'Login'
    },
    {
        path: '/home',
        component: Home,
        name: 'Home'
    },
    {
        path: '/manager',
        component: Manager,
        name: 'Manager',
        redirect: '/manager/home',  // 默认重定向到首页
        children: [
            {
                path: 'home',
                component: SystemHome,
                name: 'SystemHome'
            },
            {
                path: 'book',
                component: Book,
                name: 'Book'
            },
            {
                path: 'info',
                component: Info,
                name: 'Info'
            }
        ]
    },
]

const router = createRouter({
    history: createWebHistory(),
    routes,
})

export { router }